package edu.api.list_api;

import java.util.LinkedList;

public class Demo2 {

    public static void main(String[] args) {
        LinkedList<String> list = new LinkedList<>();
        list.add("jack");
        list.add("tom");
        list.add("rose");
        list.add("张三");
        System.out.println("原元素 = " + list);
        //首尾添加
        list.addFirst("李四");
        list.addLast("王五");
        System.out.println("首尾添加后元素 = " + list);
        String s = list.element();
        System.out.println("s = " + s);
        //获取第一个元素
        String first = list.getFirst();
        System.out.println("first = " + first);
        String s1 = list.peekFirst();
        System.out.println("s1 = " + s1);
        //移除第一个
        String s2 = list.removeFirst();
        System.out.println("s2 = " + s2);

    }



}
